home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_081 / asm68k / asm68k.doc < prev    next >
Text File  |  1992-05-06  |  61KB  |  1,261 lines

  1.                               Page 1
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                                 wAsm68kw
  11.  
  12.                             68000 Macro Assembler
  13.                                 Version 1.1.0
  14.                                     Docs
  15.  
  16.                               Date:  21-Jun-87
  17.  
  18.  
  19.  
  20.                                   NOTICE:
  21.  
  22.    THIS FILE AND THE PROGRAM IT DESCRIBES ARE COPYRIGHT © 1987, W. WESLEY
  23. HOWE. ALL RIGHTS RESERVED. A LIMITED LICENSE FOR USE AND DISTRIBUTION WITH-
  24. OUT PROFIT IS GRANTED TO POSSESSOR OF THIS FILE. NO RIGHT OF ALTERATION OF
  25. THE PROGRAM OR DOCUMENTATION IS CONVEYED WITH THIS LIMITED LICENSE.
  26.    NO WARRANTY IS EXPRESSED OR IMPLIED HEREIN ON THE SUITABILITY OF THIS
  27. PROGRAM FOR ANY PURPOSE WHATSOEVER. YOU MUST RELY ON YOUR OWN JUDGEMENT AS
  28. TO WHETHER THIS PROGRAM WILL OPERATE PROPERLY WITH YOUR COMPUTER FOR WHAT-
  29. EVER PURPOSE YOU MAY DESIRE TO USE IT FOR.
  30.  
  31.  
  32.  
  33.  
  34.  
  35.                 ADDRESS ALL QUESTIONS, COMMENTS OR CRITICISM TO:
  36.  
  37.                                   WESLEY HOWE
  38.                                4800 LAKEMONT DR.
  39.                               RALEIGH,  NC  27609
  40.  
  41.                               Page 2
  42.  
  43.  
  44.                              LIMITS:
  45.  
  46.         Source-line length:         255 bytes (including newline)
  47.         Sub-expression length:       40 bytes
  48.         Parenthesis nesting:         16 levels
  49.         Symbol length:               31 bytes
  50.         Macro Size:               8,190 bytes
  51.         Number of Macros:               Available RAM
  52.         Number of Symbols:              Available RAM
  53.         Available RAM:        1,056,768 bytes maximum heap utilized
  54.         Macro Nesting:                8 levels
  55.         Include Nesting:              8 levels
  56.         Conditional Nesting:         16 levels
  57.         Macro Parameters:            10 per invocation
  58.         Sections:                   255 maximum
  59.         Minimum RAM necessary:  128,000 bytes
  60.         Constant size:              255 bytes
  61.         Storage size:            65,535 bytes
  62.         Strings:                    255 bytes (or line length limit)
  63.         Minimum stack:            8,192 (recommended)
  64.         Operating System:               AmigaDOS 1.2 (CLI Only)
  65.  
  66. ==============================================================================
  67.  
  68.    If you are an experienced 68000 Assembly language programmer, you will
  69. find much of this material useful in understanding assembly language
  70. programming on the AMIGA. If you are an experienced AMIGA assembly language
  71. programmer, you may find much of the material boring, and will only want to
  72. use this as a reference document. If you don't know assembly language, then
  73. this document will not teach it, so you may need to get one of a number
  74. available reference books on MC68000 assembly language programming.
  75.    In the following sections, Directives, Commands, Expressions and
  76. Mnemonics are referred to. A Directive or Command is an instruction to
  77. the assembler which causes a specific action to be performed. Some of these
  78. add data to the object file, and some only affect the way assembly
  79. operations are performed. A Mnemonic is the Pseudo-English abbreviation for
  80. an instruction the assembler is to translate into the appropriate numeric
  81. sequence and include in the object file for the MC68000 processor
  82. to perform later, when your program is run. An expression refers to any
  83. sequence of items consisting of numbers, symbols with a numerical value, and
  84. the allowable math operators all of which must reduce to a single number
  85. value.
  86.  
  87.  
  88.                               Page 3
  89.  
  90.  
  91.    wInvoking the Assembler:w
  92.  
  93.    The assembler is designed to be run only from the CLI interface. If you
  94. don't know how to find the CLI interface, read the manuals that came with
  95. the machine before trying to use this program.
  96.    The minimum invocation must be the program name Asm68k followed with a
  97. source filename (separated by at least one space from the program name.)
  98. This will yield an assembly, with an object file output in the AMIGA format,
  99. and a listing file. The filenames for these files will be created by
  100. stripping any extension (period followed by characters) from the source
  101. filename and appending .o for the object filename and .lst for the listing
  102. filename. Any error messages will list to the screen.
  103.  
  104.    Example:
  105.  
  106.                 Asm68k MyProgram.a
  107.  
  108.    Outputs:
  109.  
  110.                 MyProgram.o     (The relocatable binary object file)
  111.                 MyProgram.lst   (A combined source and hex object file)
  112.  
  113.    If this isn't what you want, a wide variety of "switches" are supported
  114. to control the usage of the assembler, and the descriptions follow:
  115.    (A switch is a parameter you type after the program name and source
  116. filename, with an intervening space. These switches all start with the
  117. minus sign '-' and may be followed immediately by a letter or letters as
  118. shown below.)
  119.  
  120.    -C   This switch has been included for compatability. It should be
  121. followed with only the following characters, as many as wanted, with no
  122. spaces:
  123.         S   Generates a symbol table at the end of the list file (the
  124.             default.)
  125.         D   Does nothing.
  126.         C   Causes Case of all Labels and symbols to be ignored. With this
  127.             switch activated, LABEL, Label and label will all be interpreted
  128.             as the same name. This is not the default.
  129.         X   Does nothing.                                                
  130.    -E   Causes ERROR messages to list to the named file. It may be followed
  131. immediately with a filename containing no spaces, or type a space and then
  132. enclose the filename in double quotes if it contains spaces. You may also
  133. use the intervening space without quotes on a filename without spaces if you
  134. like. A given object filename will be used instead of the default filename
  135. normally used.                                                           
  136.    -H   HEADER file. Causes a search for the filename given after the switch
  137. (as above) which will be read as a source file before the source file is
  138. read (but after the initialization file, if enabled.) Just like the
  139. initialization file, if the file is not found, no warning or error is issued
  140. directly. All the source from this file will also be numbered as line 0.
  141.  
  142.  
  143.                              Page 4
  144.  
  145.  
  146.    -I   An INCLUDE directory search path list should follow this switch and 
  147. should contain directory names (no spaces allowed) separated from each other
  148. with plus signs '+', commas or spaces. If spaces are used, then you must
  149. space the list off from the switch and enclose the entire list in double
  150. quotes. Use of this switch will cause the assembler to search for an INCLUDE
  151. file in each of the named directories if it is not found in the current
  152. one.                                                                     
  153.    -L   Causes the LISTING file to be generated (also a default.) The usage
  154. is just like the -O switch.                                             
  155.    -N   This switch turns things off (NO.) Like -C, you should follow it
  156. with a series of letters from the following list, without any spaces:
  157.         S   Turns off the SYMBOL table normally produced at the end of the
  158.             listing file.
  159.         L   Stops the LISTING file from being generated.
  160.         E   Inhibits the ERROR file, if you turned it on.
  161.         V   A synonym for the E switch above.
  162.         P   Inhibits the PAGINATION of the listing file.
  163.         O   Inhibits the OBJECT file generation.
  164.         Q   Inhibits the conversion of mnemonics to QUICK form. The default
  165.             is to convert allowable values of ADD and SUB to the quick form
  166.             if it is safe (values already defined.)
  167.         X   Keeps the assembler from stripping the eXtension from the source
  168.             filename when forming default filenames.
  169.         R   Causes the assembler to generate the object code in a non-
  170.             RELATIVE format. The format used is the Intel format, and the
  171.             program counter is only output to 16-bits of significance. No
  172.             symbol or relocation information is output, and no linker or
  173.             loader is available to operate on this format.               
  174.    -O   Causes the OBJECT file to be generated (this is a default value.)
  175. On this switch, if no filename is given, a default filename will be formed
  176. like the error and listing names, using the extension .o                 
  177.    -R   This is the relax switch. The following parameters should follow the
  178. switch immediately, with no spaces:
  179.         M   Stops the assembler from reporting that less parameters were
  180.             supplied for a macro than were called.
  181.         R   Eliminates messages about relative references to other sections.
  182.             Note that any mnemonic that has a PC-relative mode available
  183.             will still assemble as PC-relative, and will not run on the
  184.             Amiga. Declare all references between sections as ENTRY (XDEF).
  185.             The linker can be used so as not to include resolved references
  186.             in the load file.                                            
  187.    -V   VERIFICATION file. Another name for the -E switch.
  188.                                                                           
  189.    -X   This switch should be followed immediately with up to 6 characters,
  190. and will cause the default object filename to be formed by stripping the
  191. extension and appending a period and the characters following the X.     
  192.    >   The right bracket, followed immediately with a filename, will cause
  193.  the signon, progress and all error messages to be diverted by AmigaDOS to
  194. the named file when it is the first parameter after the program name. If
  195. it is not the first, the assembler will send the error messages to the
  196. named file.
  197.  
  198.  
  199.                              Page 5
  200.  
  201.  
  202.  
  203.    All the preceding switches may be used in either UPPER or lower case, and
  204. will generate the same results. The source filename should be the first
  205. parameter after the program name, but only to avoid confusion. It must be
  206. the only parameter not associated with a switch, and may not be given twice.
  207. The source filename is the only mandantory command-line parameter.
  208.  
  209.  
  210.                              Page 6
  211.  
  212.  
  213.                           Math & Logic Operators:
  214.  
  215.          +      Addition                 -      Subtraction or Negation
  216.          ~      NOT                     <<      Left shift
  217.         >>      Right shift              &      AND
  218.          |      OR                       !      OR  (for compatability)
  219.          ^      XOR (Exclusive OR)       /      Integer Division
  220.         %%      Integer Modulo           *      Integer Multiplication or
  221.                                                 Program Counter Location
  222.  
  223.    All expressions evaluate in strict Left-to-Right order, as divided by
  224. parentheses. Symbols and constants may be mixed, and space or tab characters
  225. may be included. No individual portion of the expression may exceed 40
  226. characters (NOTE: a 'portion' would be any symbol or number alone.)
  227.  
  228. Some examples:
  229.         4+(7*2)         Yields  18      4 + ( 7 * 2 )   Yields  18
  230.         4+7*2           Yields  22      -4*6            Yields -24
  231.         6*-4            Yields -24      4(6*7)          Error
  232.         ('A'+1)         Yields  66      "A" + 1         Yields 194
  233.         'ASDF'+0        Yields  1,095,976,006
  234.  
  235. Program Counter: The symbol * can be used as shorthand for the current
  236. PC (relative offset) under the following criteria if it occupies the
  237. position in an expression normally occupied by a value.
  238.  
  239.  
  240.                              Page 7
  241.  
  242.  
  243.  
  244.  
  245.                            Numbers and Constants:
  246.  
  247.    Binary:   A binary number is either [1] prefixed with the '%' (percent)
  248. character, or [2] followed immediately with the letter 'B' (UPPER or lower
  249. case). It may contain only the digits '1' or '0'.
  250.  
  251.    Octal:   An octal number is either [1] prefixed with the '@' (at)
  252. character, or [2] followed immediately with either the letter 'O' or the
  253. letter 'Q', in either case. Only the digits '0' through '7' are valid.
  254.  
  255.    Decimal:   A decimal number contains only the digits '0' through '9', and
  256. may be optionally followed immediately with the letter 'D' (either case.)
  257.  
  258.    Hexa-Decimal:   HexaDecimal numbers contain the digits '0' through '9',
  259. and the letters 'A' through 'F' (in either UPPER or lower case.) They may be
  260. [1] prefixed with the '$' (Dollar) character, or [2] they must start with a
  261. digit and be followed immediately with either the letter 'H' or the letter
  262. 'X', in either UPPER or lower case. A leading '0' may be prefixed for the
  263. post-fix form.
  264.  
  265.    Leading zeros do not affect the value of any of the number forms,
  266. although the 40 character limit applies to them also.
  267.  
  268.    Characters:   Multiple ascii character may be included by enclosing them
  269. in QUOTES. The single quote will yield an ascii value, and the double
  270. quote will yield an ascii value with bit 7 SET (or'd with 128). Multiple
  271. byte constants are evaluated by successive left-shifts. Only the last 4
  272. characters are retained as a 32-bit value.
  273.  
  274. Some Examples:  The number 1,000 (one thousand) may be represented
  275.                 any one of the following ways:
  276.  
  277.                 1111101000B     01111101000b    %1111101000
  278.                 1750Q           01750o          @1750
  279.                 1000D           0001000d        1000
  280.                 3e8H            03E8h           $3e8
  281.                 'E0'-'AH'
  282.  
  283.  
  284.                              Page 8
  285.  
  286.  
  287.  
  288.  
  289.  
  290.                           Assembly Line Format:
  291.  
  292.  
  293.  
  294.    An input assembly line follows the following models:
  295.  
  296.  
  297. Label1          Mnemonic        Operand , MoreOperands ;comment
  298.  Label2:        Mnemonic        Operand
  299.                 Mnemonic        Operand
  300. Label3:         Mnemonic
  301. LabelOnly
  302. *                                       a comment only
  303.         ;                               another comment
  304.  
  305.  
  306.    Note that the LABEL either starts in the first column, or is followed by
  307. a colon. The Mnemonic field is separated by at least one space or tab, and
  308. never starts in the first column. Operands, where needed, follow, separated
  309. from the Mnemonic by at least one space or tab. Multiple operands are
  310. separated from each other by a comma (the comma flags the assembler that
  311. there is another operand available.) An asterisk in the first position on
  312. the line indicates a comment only line, or comments may follow complete
  313. operands with a semicolon separator. Assembler directives occupy the
  314. Mnemonic position, and comments are optional. Labels are allowed on all
  315. lines, and are required for some assembler directives.
  316.  
  317.  
  318.                              Page 9
  319.  
  320.  
  321.                             Constants:
  322.  
  323.    The following Assembler directives cause the inclusion of data in the
  324. Object file:
  325.  
  326.    DB   Yields 8-bit values. Either STRINGS, Symbols, Labels, numbers or
  327. expressions may be evaluated. Multiple operands need to be separated by
  328. commas, and generate successive bytes up to a limit of 255 bytes (the line-
  329. length limit should prevent this from ever being reached.)
  330.  
  331.    DW   Yields 16-bit values, in Hi-Lo order. The format is the same as the
  332. DB directive, except STRINGS will not be evaluated. If the address is not a
  333. word address, a pad byte will be appended to the previous line, and a non-
  334. fatal error message will be issued.
  335.  
  336.    DL   Yields 32-Bit values. Otherwise equivalent to DW.
  337.  
  338.    DC   This directive is the same as DW. Appending .L or .B (in either
  339. case) will change the function to be the same as DL or DB, respectively.
  340. (DC.W is legal.)
  341.  
  342.    ASCII   This command yields a sequence of bytes equivalent to the ascii
  343. value of the operands (delimited by quotes) provided. Single quotes will
  344. yield the normal value, and double quotes will yield values with bit 7 SET.
  345. Within the delimited STRING, a '\' (backslash) character, followed by up to
  346. three decimal digits will cause inclusion of a byte with the same numerical
  347. value, or if followed by any other character will allow the inclusion of
  348. that character immediately following. (This is useful for including quotes
  349. and backslashes in the string.) A limit of 255 values applies.
  350.  
  351.    CSTRING   This command is the same as ASCII, except an additional byte
  352. with the value 0 is appended (as in the C language.)
  353.  
  354.    PSTRING   This is the same as ASCII also, except a leading byte with a
  355. value equal to the number of bytes following is prepended (as used in the
  356. PASCAL language).
  357.  
  358.    ISTRING   This variant of ASCII will cause the final character to have
  359. it's most significant bit of the opposite (INVERTED) value from the rest of
  360. the characters in the string (as defined by the delimiting quotes). This
  361. form is popular among 8-bit machines, and some BASIC interpreters. It's
  362. usefulness with the new international 8-bit standard ASCII is questionable,
  363. but it may be helpful, so it has been included anyway.
  364.  
  365.    DCB   This command accepts the .B .W and .L size specifiers (or defaults
  366. to WORD.) It generates as many values as the operand expression evaluates
  367. to (up to 255 bytes total), of the size specified. WORD and LONG sizes
  368. are forced to an even address alignment.
  369.  
  370.  
  371.                              Page 10
  372.  
  373.  
  374.  
  375.                            Symbol and Labels:
  376.  
  377.    A Label is an address designator. It is placed before a mnemonic or a
  378. data location, and acquires a value equal to the relative program counter
  379. value at that location. A standard Label may only be defined this way once
  380. in a program, but may be referenced as many times as needed. It must start
  381. with a letter, a period or the '_' (underscore) character, and may contain
  382. only these characters, or the digits '0' through '9', without spaces up to
  383. a total of 31 characters. When you define a label, it must appear as the
  384. very first item on a line, or you must append a ':' (colon) character to it.
  385. (You may have the colon in the first case also.) You must not use the colon
  386. on the label other than when you define it, or you may get an erroneous
  387. interpretation of your expression.
  388.    A Symbol starts off looking like a label, and follows the same rules,
  389. except the following commands modify it to acquire a new type and value:
  390.  
  391.    EQUATE   Sets a permanent, absolute value equal to the value of the
  392. expression following this directive. STRING values are not allowed.
  393.  
  394.    SETVAL   Sets an absolute value which is retained until a new value is
  395. set. You may not later use EQUATE on this label, but you can EQUATE a
  396. different label to the set value.
  397.  
  398.    EQUR   Gives a value to the symbol which may later be used in place of a
  399. standard data or address register. This is valid only for D0-D7 or A0-A7 (SP
  400. is a synonym for A7). You cannot use this value other than to reference a
  401. register in a MC68000 mnemonic.
  402.  
  403.    REG   Accepts a register-list operand for use with the MOVEM mnemonic. A
  404. register-list looks like this:
  405.  
  406.                         A2-A7/D1/D3-D7
  407.  
  408. Which defines the registers A2 through A7, D1 and D3 through D7. In fact,
  409. all the registers except A0, A1, D0 and D2. Only the standard address and
  410. data registers may be defined in this fashion.
  411.  
  412.    MACRO   Assigns a sequence of input lines, with replacable parameters,
  413. which will later be substituted for any line which uses this symbol as a
  414. mnemonic or command. More on Macros later.
  415.  
  416.    These Directives must have a Label in the Label Field for assignment,
  417. except for MACRO, which may have it's name in the operand slot.
  418.  
  419.  
  420.                              Page 11
  421.  
  422.  
  423.    You must avoid referencing a symbol before giving it a value, or the 
  424. assembler will complain (sometimes), because the forward reference will make
  425. it type the symbol as a label, which is an address, not a number. Labels, of
  426. course, may be referenced before use, and it's value will be substituted on
  427. the second pass. In fact, this is the only reason you need a two-pass
  428. assembler.
  429.  
  430.  
  431.                            Local (Numeric) Labels:
  432.  
  433.    A line may be labeled with a special Local Label which attaches itself to
  434. a specific offset from the last proper line label, as previously described.
  435. A Local Label is a sequence of up to three decimal digits followed by the
  436. '$' (Dollar) character. Like a regular Label, if it does not start at the
  437. beginning of the line, it must be followed by a colon.
  438.    A Local Label may be referenced in an operand anywhere a line Label
  439. would, but it's scope is only between one regular Label and the next. Each
  440. time a new regular Label is used, the Local Label may then be redefined and
  441. reused with a different value.
  442.  
  443.    An example:
  444.  
  445. Start   Jsr     Initialize_Data
  446. 001$    Jsr     Initialize_Serial
  447.         Move.b  D1,ChangeFlag
  448.         Cmp.b   #0ffh,D1
  449.         Bne     1$
  450.  
  451.    Note that 001$ and 1$ will evaluate to the same location. You need not
  452. start with one and may use any numbers you desire, as long as their value
  453. does not exceed 999. Also, note that $1 and 1$ are interpreted differently;
  454. the first is an absolute expression, and the second is a relative address.
  455. Local Labels may not be used for Macro names, although they may be used
  456. within Macros, and cannot be used to represent Numbers, EXTERNal or ENTRY
  457. types.
  458.  
  459.  
  460.                              Page 12
  461.  
  462.  
  463.                          Conditional Assembly Directives:
  464.  
  465.    The following Commands allow assembly to proceed until a matching ENDIF
  466. Directive is found, or disable assembly until the ENDIF is reached if the
  467. condition is not met:
  468.  
  469.         IFEQ    Expression EQuals zero. (e.g. 4-4)
  470.         IFGE    Expression Greater than or Equal to zero. (e.g. 4-4 or 4-3)
  471.         IFGT    Expression Greater Than zero. (e.g. 4-3)
  472.         IFLE    Expression Less than or Equal to zero. (e.g. 4-4 or 4-5)
  473.         IFLT    Expression Less Than zero. (e.g. 4-5)
  474.         IFNE    Expression is Not Equal to zero. (e.g. 4-5 or 4-3)
  475.  
  476.    The above conditionals are evaluated to 32 bits, but the condition
  477. decision is based on their WORD (16-bit) value.
  478.  
  479.         IFD     Label following was already Defined (not just referenced.)
  480.         IFND    Label following has Not yet been Defined.
  481.         IFC     Both STRINGS following Compare (same length and characters.)
  482.         IFNC    Both STRINGS do Not Compare (different length or
  483.                            characters.)
  484.  
  485.    The last two conditional commands need two operands, separated by a
  486. comma. They may be delimited with Quotes (single or double), or by a left
  487. bracket '<' and right bracket '>' pair, or the first string will start at
  488. the first character which is not a space or a tab, and end at the first
  489. occurrence of a comma or space or tab, and the second will start at the
  490. next character which is not a comma or a space or a tab and will end at
  491. the first space, tab, semicolon or newline character. To enclose spaces in
  492. the string, you must use either the quote or bracket delimiters. To enclose
  493. quotes, use the brackets, and to enclose brackets, use the quotes. Both
  494. quotes and brackets cannot be passed together unless you use the spaces,
  495. but then you can't have spaces in the string. Just shows to go you,
  496. everything is a compromise. Any backslash character sequences are not
  497. expanded before comparison (except inside Macros.)
  498.    Each Conditional command DO level ends with an ENDIF command. DO levels
  499. nest only to 16 levels, or a fatal error will be generated (whether the
  500. assembly is on or off, each IFxx increases the level count, and each ENDIF
  501. decreases the count; exceeding 16 or going below zero are fatal errors.) DO
  502. levels are not active during a macro definition, but will be evaluated
  503. during a macro expansion.
  504.  
  505.  
  506.                              Page 13
  507.  
  508.  
  509.  
  510.                        Other Assembler Directives:
  511.  
  512.  
  513.    RESERVE   Creates an uninitialized data storage area, with a size equal
  514. to the expression following it. The size designators .B .W and .L (any
  515. case) may be used, or WORD is assumed. The expression following the
  516. Directive is expanded to the size specifier. This is the only Directive
  517. which is not limited in size to 255 bytes for the result, but may yield up
  518. to 65,535 bytes.
  519.  
  520.    ENDSRC   Shuts off assembly for the current DO level. (See the section on
  521. conditional assembly for DO level explanation.) If you are not in a DO
  522. level, the source is read to the end of file, but no assembly action will
  523. occur.
  524.  
  525.    OPTION   This command accepts the following operands only:
  526.  
  527.             M - Allows macro call lines to print in the assembly listing.
  528.                 (If List is on.) This is the default condition.
  529.            NM - Hides macro call lines, showing expansion lines only.
  530.             L - Turns on listing. (The default condition).
  531.            NL - Shuts off Listing.
  532.  
  533. (Neither of these commands override the command-line switches directly, they
  534. only control the flow of data. An assembly will still create a list file if
  535. not prohibited, Option NL will just make it an empty file. If the list file
  536. was disabled on the command line, Option L will not send the listing
  537. anywhere. None of the operands are case-sensitive.)
  538.  
  539.    TITLE   Accepts a STRING (delimited by quotes) which will label all
  540. pages, if paging is not disabled. The Maximum title length is 40 characters.
  541. Also cause pages to be numbered.
  542.  
  543.    ORIGIN   Sets the program counter to the value of the expression
  544. following the command. Origin remains relative on AMIGA output format.
  545.  
  546.    PAGEUP   Causes a page to end if paging is not disabled. A form-feed
  547. character is sent, and a page heading with the optional title (see TITLE) is
  548. printed.
  549.  
  550.  
  551.                              Page 14
  552.  
  553.    SECTION   This command causes a new section, or Hunk, to be created in
  554. the AMIGA output format. The first operand must be a name containing no
  555. spaces and having less than 40 total characters. The second operand, if
  556. given, should be separated by a comma and should be either CODE, TEXT, DATA
  557. or BSS. If none is given, CODE is assumed. (only the first character is
  558. checked, however, so DUMMY will yield a DATA section definition.) TEXT is
  559. equivalent to CODE. Case is not significant on the section type, but case
  560. is important for the name. Optionally, the type may be followed by a
  561. comma and either PUBLIC, FAST or CHIP to specify the memory type in which
  562. the hunk is to load. If the operand isn't present, PUBLIC (any) is the de-
  563. fault. If the section name has been used before, assembly will proceed at
  564. the next location as was previously defined, and the resultant code, data
  565. or storage space will be coalesced into one Hunk. AmigaDOS loads different
  566. hunks into different memory locations, so all references to data between
  567. sections should be to Labels declared as ENTRY (XDEF) to ensure assembly
  568. as absolute locations. A warning is issued (unless shut off, see the
  569. switches section) when this condition is detected. See the AmigaDOS manual
  570. for more information on Hunks.
  571.  
  572.    IDENTIFY   This command should be followed with a name, which will be
  573. given to the program unit (a program unit is a hunk or a collection of
  574. hunks to be fed to the linker.) Only the first name given will be used,
  575. subsequent uses are ignored. If the IDENTIFY command is not used during an
  576. assembly, the object file will be given a name that has 0 characters in
  577. it. (Null string.)
  578.  
  579.    EXTERN   Followed by one or more Labels or symbols (separated by commas.)
  580. These labels must not be defined within the  entire assembly source, and
  581. cause the assembler to generate the appropriate external reference
  582. instructions in the object file (AMIGA format only) for resolution by the
  583. linker. Multiple EXTERN usage on the same Symbol name is ignored.
  584.  
  585.    ENTRY   Followed by one or more Labels or Symbols. These labels, which
  586. need to be defined somewhere, allow locations within the program unit to be
  587. visible to the linker to resolve other program unit EXTERNal references. A
  588. program that consists of more than one object file will need to have an
  589. ENTRY in one unit for every EXTERN in the other units, or the program will
  590. 'BOMB' and probably either lock-up the machine or cause the dreaded GURU to
  591. appear. References between different sections must be to ENTRY labels, since
  592. the AMIGA loader will place each section wherever it will fit, and resolve
  593. all these different addresses. If you never use the section command, the
  594. entire program will have to fit in the same place, and might not be able
  595. to be loaded if there is not a spot big enough for the whole thing
  596. (depending on how many tasks might also be running, etc.) As for EXTERN,
  597. duplicate references to the same name cause the second reference to be
  598. ignored.
  599.  
  600.  
  601.                              Page 15
  602.  
  603.  
  604.    EXECUTE   This command will pass the quote delimited string following it
  605. to AmigaDOS during the second pass. The current window is the input and
  606. output. A more detailed description of the Execute routine is located in
  607. the AmigaDOS manual, but basically the same things you can do from the CLI
  608. may be contained within the string and executed from within the assembler.
  609. The Source, Object and any open Include files will be locked, and cannot
  610. be accessed at this time. No use is made of the return value from the
  611. program called.
  612.  
  613.    CNOP   This Directive causes null filler bytes to be inserted into the
  614. object file until the desired alignment is reached. There may be one or two
  615. values after the Directive, separated a comma. The second value given, or
  616. the single value is the desired alignment value you want, and the first
  617. value when two values are given is how many more bytes to add beyond this
  618. point. There may not be more than 255 bytes generated in total to acheive
  619. the desired alignment, and no restrictions are imposed on what alignment
  620. values can be used, but values that are not powers of two will normally
  621. not generate a correct alignment. If you want to set the Program Counter 2
  622. bytes beyond the next PC location evenly divisible by 8 use the command
  623. like this:
  624.  
  625.                         CNOP   2,8
  626.  
  627. The predominant reason for using this command would be to align data at
  628. specific offsets, and to create data structures in specific formats.
  629.  
  630.  
  631.                              Page 16
  632.  
  633.  
  634.  
  635.                             Include Files:
  636.  
  637.    Up to 8 levels of include files may be inserted into the assembly with
  638. the INCLUDE Directive. The syntax demands a Filename or Path, delimited by
  639. quotes. Include file directory searches are supported by command-line
  640. parameters (Detailed in another section.) Include files may be called by
  641. Macros, and Macros may be used by Include files, up to their respective
  642. nesting levels (8 each.) The INCLUDE directive will cause the next source
  643. line to be read from the named file as if the entire contents appeared in
  644. the original source file, except line numbering will start at one again,
  645. and the line number will be followed by a '+' (plus) sign. When the end of
  646. the Include file is reached, the line number will revert to the one
  647. following the line which invoked the INCLUDE Command.
  648.    Special provisions have been made to allow automatic and command-line
  649. inclusion of header and/or macro definition files before assembly starts,
  650. and these files do not count in the nesting level limits for Include
  651. files. A later section will describe command-line parameters and the
  652. configuration file.
  653.  
  654.                           A SPECIAL NOTE:
  655.  
  656. Several of the existing include files from Commodore do not assemble
  657. correctly (particularly those in the exec directory.) Many of the source
  658. lines in these files contain comments which are delimited only by spaces
  659. and an asterisk. Asm68k is not restrictive about spaces within an
  660. expression, and tries to assemble the asterisk as a multiplication operator
  661. with the words in the comment being looked at as labels, and gives
  662. appropriate error messages. Make sure the comments are stripped or
  663. delimited by a semi-colon. A few of the files contain Macro error checks
  664. using an IFC \1,'' which will not assemble correctly with Asm68k. Use IFEQ
  665. NARG instead. Lists.i contains a parenthesized expression as an offset for
  666. an address register. Asm68k will not accept parentheses within 68000
  667. mnemonics except when they are immediate type, as the parentheses denote a
  668. register designation. These changes will make both assemblers happy, and
  669. the include files more portable between applications.
  670.  
  671.  
  672.                              Page 17
  673.  
  674.  
  675.  
  676.  
  677.                                Macros:
  678.  
  679.    The best feature of the assembler, and the hardest one to master, is the
  680. use of the MACRO command. A Macro is simply a sequence of source lines which
  681. may be saved and inserted as often as wanted just by using the name you gave
  682. it as a command. A Macro may contain any of the other Directives and
  683. Mnemonics the assembler recognizes except another MACRO definition command,
  684. although you may use the name of a defined Macro in your Macro (up to 8
  685. levels deep.)
  686.    A Macro is defined (and it must be before being used) by placing the
  687. MACRO in the Mnemonic Field, either before or after it's name. The name for
  688. the Macro must follow the rules for Labels if it is on the left side, or if
  689. it is on the right side it needs to be separated by at least one space or
  690. tab from the MACRO Directive, and follow all the Label rules except it does
  691. not need to be followed by a colon. All the subsequent lines up to the one
  692. which contains the ENDMAC command will be saved for subsequent use.
  693.    The real power of Macros comes from their use with replacable parameters.
  694. When you issue a Macro name as a Command, up to ten parameters (numbered
  695. from one to nine, with zero for ten) may be included in a comma, space or
  696. bracket separated list after the name for use within the Macro text. To make
  697. these parameters appear in the Macro expansion, place a '\' (backslash)
  698. character followed immediately (no spaces) with the digit of the parameter
  699. you want in the definition. When the macro is expanded, the text will
  700. include the parameter placed on the calling line, and will be evaluated just
  701. as if the source had included it as it appears. Parameters are gathered and
  702. passed as they appear, quotes and all.
  703.    The backslash character may be passed to the Macro by including two
  704. backslashes in the calling line, and any non-numeric character following
  705. a backslash other than a backslash will pass both the backslash and the
  706. character following it to the Macro. To pass numeric sequences for use
  707. in a string (such as with the ASCII directive), use two backslashes [as
  708. in \\13, to put the sequence \13 , which puts a carriage return with the
  709. quoted string].
  710.    Conditional Directives are effective within the Macro, under the same
  711. rules as they follow elsewhere. If assembly is enabled, and the Directive
  712. MEXIT is encountered, expansion of the Macro is suspended, and the next
  713. source line will be the one following the Macro invocation line, after the
  714. assembler has examined the remaining Macro text and resolved all the IFxx
  715. and ENDIF levels.
  716.    To make Macros respond differently with different numbers of passed para-
  717. meters, the special symbol NARG (not case-sensitive) has been reserved. It
  718. will yield a value equal to the number of parameters found on the invocation
  719. line within a Macro expansion, and zero elsewhere.
  720.  
  721.  
  722.                              Page 18
  723.  
  724.  
  725.  
  726.    One additional feature within Macros is the \@ (backslash followed by the
  727. at character). While the Macro is being expanded, this combination is
  728. changed to a period followed by three decimal digits. These digits
  729. increment starting from zero every time a macro call is made that uses the
  730. \@ combination, and will be used for the duration of that macro (a
  731. contained macro call will use a new number, then when it ends the former
  732. macro's number will be used until it ends. This allows unique symbol names
  733. to be generated within the Macro text, allowing branch instructions to
  734. occur. Local (numeric) Labels are effective within the Macro, but they do
  735. not attach to the Macro name, nor are they canceled by the Macro invocation
  736. (unless the invocation line was labeled.) 
  737.  
  738.  
  739.                              Page 19
  740.  
  741.  
  742.  
  743.                        Do Nothing Directives:
  744.  
  745.    The following directives are accepted by the assembler, but cause no
  746. action and generate no code, just as if they were comments. They have been
  747. included to allow use of source code written for other assemblers.
  748.  
  749.         MASK2           FORMAT       SPC
  750.         NOL             OFFSET
  751.  
  752.  
  753.                       Synonym Directives:
  754.  
  755.    The directives in the left column are substitute names for the directives
  756. in the right column, and were included for source compatability:
  757.  
  758.                 DS              RESERVE
  759.                 END             ENDSRC
  760.                 EQU             EQUATE
  761.                 SET             SETVAL
  762.                 TTL             TITLE
  763.                 ENDC            ENDIF
  764.                 ENDM            ENDMAC
  765.                 RORG            ORIGIN
  766.                 XREF            EXTERN
  767.                 XDEF            ENTRY
  768.                 RORIGIN         ORIGIN
  769.  
  770. ===============================================================================
  771.                         Unimplemented Directives:
  772.  
  773.    The following Directives, found in some other assemblers, have not been
  774. implemented in this version:
  775.  
  776.         IDNT            FAIL            LIST
  777.         LLEN            PAGE            PLEN
  778.         NOOBJ           NOLIST          NOPAGE
  779.    A startup Macro file has been included with this package to allow some
  780. compatability if these are needed.
  781.  
  782.  
  783.                              Page 20
  784.  
  785.  
  786.  
  787.  
  788.                             Startup Configuration:
  789.  
  790.    If a file named Asm68k.cnf (or with a filename the same as the assembler
  791. with the extension .cnf) is found in the same directory spec the assembler
  792. was called from, it is read and acted on. The current version only looks for
  793. two items in this file, the pagelength (which must be greater than 11) and
  794. the name (and path) of the startup file. The format is:
  795.  
  796.  
  797.         Page Length:    1 byte (11-255), binary
  798.         File Path:      up to 31 bytes, ascii
  799.         Terminator:     1 byte, binary, value 0
  800.  
  801.  
  802.    Any remaining characters after the null byte are ignored. The assembler
  803. next looks for the filename or path given, and if this file is found, it
  804. is read and assembled as if it was the beginning of the Source file. All
  805. lines from this file are numbered 0, and no warning or error occurs if the
  806. file is not found (unless, of course, you were depending on the definitions
  807. in your program, then you could have lots of error messages.)
  808.    Beware when building this file that the null character must be at the end
  809. of the pathname or you may crash the system. You can create a file from the
  810. keyboard using the command:
  811.  
  812.  
  813.               COPY con: to Asm68k.cnf
  814.  
  815.  
  816. then typing a character for the pagelength (B is 66, the standard),
  817. following it with the pathname for the startup file, followed with a
  818. control@ (CTRL key and 2 key together), then ending it with a control\
  819. (CTRL and \ keys together.) If you make a mistake, you cannot edit the file,
  820. so do the control\ and start over.
  821.  
  822.  
  823.                              Page 21
  824.  
  825.  
  826.  
  827.  
  828.  
  829.                               Other notes on use:
  830.  
  831.  
  832.    Case is normally significant on Symbols, Labels and Macro names unless
  833. the -CC switch is used. The Directives, Mnemonics and special symbols will
  834. be recognized in any mixture of UPPER and lower case.
  835.    The only truly reserved symbols are the following:
  836.  
  837.  
  838.                 NARG    MACRO   ENDMAC  ENDM    A0
  839.                 A1      A2      A3      A4      A5
  840.                 A6      A7      D0      D1      D2
  841.                 D3      D4      D5      D6      D7
  842.                 SP      CCR     USP     SR      PC
  843.  
  844.    All the other special Symbols, Mnemonics and Directive names  may be
  845. defined and used as Labels, or may be implemented as Macros, but be careful
  846. when doing this to avoid circular references, which will not be detected
  847. until the Macro nesting level is exceeded, or a write error results from
  848. the disk being full.
  849.    For example, if you redefine JSR as a Macro, and want to use it in the
  850. Macro definition, don't call the assembler with the -CC switch, and be sure
  851. to use a different case within the Macro text to get the assembler to recog-
  852. nize the Mnemonic, which is case-insensitive, from the Macro name.
  853. This allows the maximum flexibility for the assembler, with only a minimum
  854. of care from the programmer.
  855.  
  856.  
  857.                              Page 22
  858.  
  859.  
  860.  
  861.                                Error Messages:
  862.  
  863.    The assembler uses as much logic as possible to generate a line of code
  864. in spite of erroneous input. If a reliable evaluation can be made, a source
  865. line will be interpreted regardless of errors, however some of these lines
  866. may not be what you meant. Even the little bit of DWIM in this assembler
  867. occupies a lot of code space. Because assembly of erroneous lines is
  868. attempted where possible, you may find multiple error messages referring
  869. to the same line. The listing file will only contain the first error
  870. detected, however the screen list or error file will also list the errors
  871. in the order they were detected. Some errors may generate errors later,
  872. especially if typing errors cause the assembler to find an item it thinks
  873. is an undefined symbol in an expression, and you later used this symbol
  874. for another purpose. The following is a list of error messages, and
  875. explanations:
  876.  
  877.          1: Error in Expression Value
  878.                 The expression being evaluated contained some garbage.
  879.          2: Duplicate Line Label
  880.                 An attempt at defining a Label twice was detected. This
  881.                 error does not apply to ENTRY and EXTERN label types.
  882.          3: Undefined Label in Expression
  883.                 The symbol or label used in the expression was not defined
  884.                 anywhere in the source file.
  885.          4: Syntax Error
  886.                 The assembler could make no sense of what you were trying to
  887.                 tell it to do.
  888.          5: Operand Too Large
  889.                 The operand was greater than the value allowed for the
  890.                 operation being performed.
  891.          6: Invalid Register Specified
  892.                 The register called for in the current operation and what
  893.                 was found are not compatable.
  894.          7: Undefined Mnemonic or Command
  895.                 An item in the Mnemonic field is not a defined Macro or
  896.                 valid mnemonic or directive. May also be caused by using
  897.                 a label outside of column one without a colon following it.
  898.          8: Improper use of Unary Operator
  899.                 A Unary operator ('-' or '~') was found right after another
  900.                 math operator. The expression evaluator cannot handle this,
  901.                 so it is ignored and this message is output.
  902.          9: Division by Zero
  903.                 A Division or Modulo operation was attempted where the right
  904.                 hand value was zero or undefined. The result of this
  905.                 operation is set to zero.
  906.  
  907.  
  908.                              Page 23
  909.  
  910.  
  911.  
  912.         10: Too Many Right Parentheses
  913.                 More right parentheses were found than left parentheses.
  914.         11: Missing Right Parenthesis
  915.                 More left parentheses were used than right parentheses.
  916.         12: Too Many Parenthesis Levels
  917.                 More than 16 levels of parentheses were attempted to
  918.                 be opened.
  919.         13: Invalid Character in Expression
  920.                 A character was found in the expression that is not
  921.                 any of the defined mathops, numbers, symbol characters
  922.                 or newline characters.
  923.         14: Closing Quote Absent
  924.                 No closing quote on a character constant was found.
  925.         15: Operand Field Missing
  926.                 An operand was needed, and was not there.
  927.         16: Bit Operand Required
  928.                 The expression needs a bit operand, and what was found was
  929.                 not of the required type.
  930.         17: Invalid Bit Specified
  931.                 The data found cannot be used legally to specify a bit.
  932.         18: Immediate (#) Operand Needed
  933.                 The data given was not preceded by the '#' (pound) sign,
  934.                 and needed to be.
  935.         19: Branch or Jump Out-of-Range
  936.                 The address evaluated is outside of the range allowable for
  937.                 the branch of jump mnemonic specified.
  938.         ** Command Line Required **
  939.                 The message output when no arguments are present on the
  940.                 command-line (you need at least the source filename.)
  941.                 Also a Fatal error.
  942.         ** Unrecognized Switch **
  943.                 A switch or a character within a switch was not one of
  944.                 the valid switches. Not a Fatal error.
  945.         ** File Write Error **
  946.                 An error occurred during a file write, as reported from
  947.                 AmigaDOS. May be caused by a full disk.
  948.         ** Source Filename Missing **
  949.                 The source filename was not present, corrupt or was given
  950.                 twice. A Fatal error.
  951.         ** Parameter Too Long **
  952.                 An Item on the command-line was too long to be evaluated.
  953.                 Also Fatal.
  954.  
  955.  
  956.                              Page 24
  957.  
  958.  
  959.  
  960.  
  961.         ** Insufficient Free Memory **
  962.                 This error occurs when the memory pool does not contain
  963.                 enough memory in a size large enough for the request
  964.                 from the assembler to be filled. Execution stops
  965.                 immediately.
  966.         ** Too many Include Files **
  967.                 This error occurs when you try to open the ninth Include
  968.                 file before closing one.
  969.         ** Couldn't open Source file **
  970.                 AmigaDOS did not return information indicating that the
  971.                 source file was ready to be read from (or it isn't there.)
  972.                 No assembly will take place without a source file.
  973.         ** Couldn't open Object file **
  974.                 A Dos error occurred trying to open the object file.
  975.         ** Couldn't open Listing file **
  976.                 Same error from listing file open attempt.
  977.         ** Couldn't open Error file **
  978.                 Like above, but on error file attempt.
  979.         33: ENDMAC Command missing
  980.                 The end of the source file was reached, and the assembler
  981.                 was still saving a macro definition.
  982.         34: Too Many Parameters present
  983.                 More parameters than the assembler has space to store
  984.                 were found.
  985.         35: Parameter Too Long
  986.                 An item in an expression or an operand was longer than the
  987.                 defined limit.
  988.         36: Closing Quote Missing
  989.                 A string definition should be bounded on both ends with
  990.                 matching quotes.
  991.         37: No Label on Line
  992.                 No label was present for the Directive to act upon.
  993.         38: Macro called using Symbol label
  994.                 A symbol name found in the mnemonic field was attempted
  995.                 to be used as a Macro, and was found to be a Label.
  996.         ** Too many nested Macros **
  997.                 This Fatal error occurs when the ninth Macro call is
  998.                 issued before any of the previous Macro calls have ended.
  999.         40: Macro redefinition Error
  1000.                 The name used with the MACRO command is already the name
  1001.                 of a previously defined Macro.
  1002.  
  1003.  
  1004.                              Page 25
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.         41: ENDMAC command without MACRO definition
  1011.                 You didn't use the MACRO command to define your Macro, or
  1012.                 you issued the ENDMAC command twice. If you are attempting
  1013.                 to get two or more exit points from a macro, use the
  1014.                 MEXIT Directive.
  1015.         ** INCLUDE file unable to be opened **
  1016.                 This Error occurs when the filename associated with the
  1017.                 INCLUDE command was not found after the include directory
  1018.                 list was exhausted.
  1019.         ** Source or Include file line too long **
  1020.                 An input line read from disk contained more than 255
  1021.                 characters in a row without a carriage return or
  1022.                 linefeed.
  1023.         44: Not enough Macro parameters supplied
  1024.                 An expansion was attempted and there were not enough
  1025.                 parameters on the Macro call line. This may be relaxed
  1026.                 with a command-line switch.
  1027.         45: Label Value changed between passes
  1028.                 This unusual error occurs when the value of a Line Label
  1029.                 is different on the second pass than it was on the first
  1030.                 pass. The whole assembly file is probably corrupt, and
  1031.                 it is likely that the message will repeat with every
  1032.                 subsequent Line Label found. Forward references and
  1033.                 absolute references to SETVAL Labels, or conditional
  1034.                 compilation based on SETVAL Labels are the likely
  1035.                 culprits behind this error.
  1036.         46: Invalid Label - Forward Referenced
  1037.                 A Label which was referenced before it was used was later
  1038.                 found in a context other than usage as a relative location.
  1039.         47: Local Definition of External Symbol not allowed
  1040.                 If you declared a Symbol to be EXTERNal, you cannot define
  1041.                 it within the current assembly. Use the ENTRY Directive
  1042.                 instead if this is what you want.
  1043.         48: Unavailable Addressing Mode Used
  1044.                 The addressing mode used for the Mnemonic on this
  1045.                 line is not one which is allowable for that
  1046.                 Mnemonic.
  1047.         49: Invalid Item in External Reference Expression
  1048.                 An external reference included an item which did not
  1049.                 belong there. This also occurs on an attempt to
  1050.                 generate PC relative references to external addresses.
  1051.         ** Too Many Section Definitions (Limit = 255) **
  1052.                The message is self-explanatory.
  1053.  
  1054.  
  1055.                              Page 26
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.         51: Invalid Section Type - Section CODE used
  1062.                 An item found after the section name was not one of the
  1063.                 valid section types - CODE, TEXT, DATA or BSS; or the mem-
  1064.                 ory specified is not one of the valid types PUBLIC, CHIP
  1065.                 or FAST. The type is set to CODE,PUBLIC.
  1066.         52: Alignment Error - Pad Byte Added
  1067.                 All the 68000 Mnemonics and WORD and LONG oriented Direct-
  1068.                 ives need to be aligned on an even address. The Assembler
  1069.                 attempts to correct this by adding a null byte to the
  1070.                 previous instruction, and adjusts the Program Counter and
  1071.                 Label values accordingly.
  1072.         ** Too Many Conditional Levels Attempted
  1073.                 The seventeenth conditional Directive was found before an
  1074.                 ENDIF Directive was.
  1075.         ** Conditional End without Conditional Statement
  1076.                 There are more ENDIF commands than matching conditional
  1077.                 Directives.
  1078.         55: Relative Reference Outside of Current Section
  1079.                 An attempt to use a PC relative mode to a Line Label that
  1080.                 was not declared as an ENTRY label was attempted. Also
  1081.                 occurs on Data references to other sections without
  1082.                 using the ENTRY type-definition. This message may be
  1083.                 suppressed with a command-line switch.
  1084.         56: Code not allowed in Data & Bss Sections
  1085.                 DATA sections may contain only initialized and uninitialized
  1086.                 data locations, and BSS sections may contain only un-
  1087.                 initialized (RESERVE) data.
  1088.         57: Redefinition of an Equate not Allowed
  1089.                 You cannot change the a Label value that has been EQUATEd.
  1090.         58: Equate to previously SET Label Disallowed
  1091.                 A Label that was set cannot later be upgraded to an equate
  1092.                 in the same assembly. The assembler handles decisions on
  1093.                 equated labels, whose value cannot change, differently
  1094.                 than set labels, whose value may be redefined. Since the
  1095.                 length of 68000 instructions vary with the address mode,
  1096.                 a set label is always treated as a LONG value (unless
  1097.                 otherwise specified) and an equated label is treated
  1098.                 for the value it contains. Since the assembler always
  1099.                 attempts to use the shortest instruction length possible,
  1100.                 a change in the type of a label can cause bad code to be
  1101.                 generated.
  1102.  
  1103.  
  1104.                              Page 27
  1105.  
  1106.  
  1107.  
  1108.                               Addressing Modes:
  1109.  
  1110.    The following models show the valid address modes for the 68000 processor
  1111. as they are recognized by the assembler:
  1112.    ( 'n' represents a digit from 0 to 7, X represents either 'D' or 'A'
  1113.    for an address mode 'ALabel' represents a symbol with an absolute
  1114.    or an external value, 'RLabel' represents a Line Label or an
  1115.    ENTRY typed label, 'number' refers to an actual numerical value, and
  1116.    the other items are what they are. Case is not significant except on
  1117.    Label and Symbol Names. Defined REG Labels of the proper type may be
  1118.    used in place of the register names.)
  1119.  
  1120. IMMEDIATE:                       #number      #ALabel
  1121.  
  1122. DATA REGISTER DIRECT:            Dn
  1123.  
  1124. ADDRESS REGISTER DIRECT:         An       SP
  1125.  
  1126. ADDRESS REGISTER INDIRECT:      (An)     (SP)
  1127.  
  1128. ADDRESS REGISTER INDIRECT WITH POST INCREMENT:           (An)+   (SP)+
  1129.  
  1130. ADDRESS REGISTER INDIRECT WITH PREDECREMENT:            -(An)   -(SP)
  1131.  
  1132. ADDRESS REGISTER INDIRECT WITH DISPLACEMENT:            number(An)
  1133.                                                         number(SP)
  1134.                                                         ALabel(An)
  1135.                                                         ALabel(SP)
  1136.  
  1137. ADDRESS REGISTER INDIRECT WITH DISPLACEMENT AND INDEX:  number(An,Xn)
  1138.                                                         Alabel(An, Xn)
  1139.                                                         number(SP, Xn)
  1140.                                                         ALabel(SP,Xn)
  1141.  
  1142. PROGRAM COUNTER RELATIVE WITH DISPLACEMENT:             RLabel
  1143.                                                         RLabel(PC)
  1144.                                                         number(PC)
  1145.  
  1146. PROGRAM COUNTER RELATIVE WITH DISPLACEMENT AND INDEX:   RLabel(Xn)
  1147.                                                         RLabel(PC, Xn)
  1148.                                                         number(PC, Xn)
  1149.  
  1150. SHORT ABSOLUTE:         ALabel        number
  1151.  
  1152. (where the value is less than $007FFF or greater than $FF8000)
  1153.  
  1154. LONG ABSOLUTE:          RLabel (to another section)
  1155.                         ALabel        number
  1156.  
  1157. (where the value doesn't qualify for short mode)
  1158.  
  1159. SPECIAL:                USP           CCR        SR
  1160.  
  1161.  
  1162.                              Page 28
  1163.  
  1164.  
  1165.  
  1166.                             16-bit relocatable data
  1167.                             Base Register Addressing
  1168.  
  1169.  
  1170.  
  1171.    Support has been included for Base-Register addressing of data sections
  1172. for use with the "smalldata" option of the BLINK linker. When the -B switch
  1173. is used on the command line when invoking the assembler, all references to
  1174. external labels using "address register indirect with displacement"
  1175. addressing are output as ext_dref16, which BLINK will adjust so that the
  1176. offset represents the location within the merged data hunk where the
  1177. referenced data is located.
  1178.    If you are using the Lattice startup module, and linking your code with
  1179. BLINK, register A6 is supported for this use. If you are designing your own
  1180. startup module, you need to set the base register you've chosen to the start
  1181. of the data hunk(s).
  1182.    Additionally, the command "BASEREG  [register]" will convert all
  1183. references to external labels, except for immediate addressing mode and the
  1184. JMP and JSR mnemonics, to "address register indirect with displacement"
  1185. using the specified register. Using the command "BASEREG  OFF" will end the
  1186. automatic conversion. This feature has been included to allow easier use of
  1187. this mode, both in new designs and in converting existing programs.
  1188. Compatibility with other assemblers is also enhanced by using this mode,
  1189. since other assemblers which do not support this function may still assemble
  1190. the file if BASEREG is defined as a macro with a null effect (such as
  1191. DS.W 0).
  1192.    Using this mode will save 2 bytes per instruction (or 4 bytes if both the
  1193. source and destination reference external data). Object modules assembled
  1194. with either of these options will not function with the standard Amiga
  1195. linker ALINK; you MUST use BLINK to take advantage of these features. Using
  1196. BASEREG will cause all references to EXTERNal Labels where "address register
  1197. indirect with displacement" mode was used to be output as relative to the
  1198. data module, whether the -B switch was used or not, for the ENTIRE assembly
  1199. unit. There is no way to mix this mode and the standard PC-relative offset
  1200. reference without moving the code into different source files. If the data
  1201. section(s) are in the same source file, conversion will not be automatic
  1202. with the BASEREG command, as conversion is triggered by the Label's prior
  1203. definition with the EXTERN (XREF) directive.
  1204.  
  1205.  
  1206.                              Page 29
  1207.  
  1208.  
  1209.  
  1210.                                Release History:
  1211.  
  1212.  
  1213.    Version 1.0.1 Alpha1.........released 02-Jan-87.
  1214.    Version 1.0.1 Beta1..........released 11-Jan-87.
  1215.    Version 1.0.1 Beta2..........released 20-Jan-87.
  1216.    Version 1.0.1................released 28-Feb-87.
  1217.    Version 1.0.2................released 14-Apr-87.
  1218.    Version 1.0.3................released 24-Apr-87.
  1219.    Version 1.1.0................released 21-Jun-87.
  1220.         Changes:  1)  A check for duplicate temporary Labels was added.
  1221.                   2)  Attempts to use data-register-indirect addressing now
  1222.                       generate an error message instead of assembling as
  1223.                       address-register-indirect.
  1224.                   3)  Macro parameters exceeding 40 characters no longer
  1225.                       cause a crash.
  1226.                   4)  The range-check for the right-shift '>>' operator is
  1227.                       now applied to the correct operand.
  1228.                   5)  The expression evaluator now handles inline unary
  1229.                       operations, and handles the '*' correctly when used
  1230.                       with a unary operator.
  1231.                   6)  Support for CHIP and FAST memory types was added.
  1232.                   7)  DS.W 0 no longer generates an error message.
  1233.                   8)  The control-C handler works.
  1234.                   9)  The DS command now outputs NULL bytes instead of
  1235.                       random  garbage. (Although the former was technically
  1236.                       correct.)
  1237.                  10)  Support for the BLINK linker's special smalldata mode
  1238.                       was added.
  1239.                  11)  The BASEREG command was added.
  1240.  
  1241.  
  1242.    A special note of gratitude to various members of ASDF (Amiga Software
  1243. Developers Forum), The Software Distillery (whose BLink reduced the many
  1244. hours spent relinking the source files during development), and
  1245. especially John Toebes, whose offhand remarks unknowingly provided much of
  1246. the inspiration to keep going. Also DJ JAMES and KEN S for their work in
  1247. running down some of the problems I missed.
  1248.  
  1249.  
  1250. NOTE:   Amiga and AmigaDOS are trademarks of Commodore Business Machines.
  1251.         Intel is a trademark of the Intel Co.
  1252.         MC68000 is a trademark of Motorola Co.
  1253.  
  1254.  
  1255.                                 THE END
  1256.  
  1257.